/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package testyjdbc;

import java.sql.*;

/**
 *
 * @author student
 */
public class Proba {
    public static void connectToAndQueryDatabase(String username, String password) throws SQLException {

    Connection con = DriverManager.getConnection(
                         "jdbc:derby://localhost:1527/jdbcTestowanie",
                         username,
                         password);

    Statement stmt = con.createStatement();
    ResultSet rs = stmt.executeQuery("SELECT * FROM DAWID.COFFEES");
        System.out.println(con.toString()+"\n"+stmt.toString());
    while (rs.next()) {
        String s = rs.getString("COF_NAME");
        System.out.println(s);
    }
}
}
